/**
 * @Author: 耿立强
 * @Date: 2019/6/20
 * @Last Modified by: 杨光宇
 * @Last Modified time: 2021-02-07 15:21:28
 */
 import axios from '@/api/fetch';
 import SERVER from '@/api/server';

 // 审核活动列表
 export const listRecord = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/listRecord/activity`, params);
 /*添加Vin*/
 export const getVinList = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/getVinList`, { params });
 /*添加活动*/
 export const getItemList = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/getItemList`, { params });
 export const getLabourItemList = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/getLabourItemList`, { params });

 /*配件列表*/
 export const getTmPartFacList = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/getTmPartFacList`, { params });
 export const getTmPartList = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/getTmPartList`, { params });
 export const getClaimPriceList = params => axios.post(`${SERVER.CLAIMFAC}/rpClaim/getClaimPriceList`);


 /*附加项目 */
 export const getAddList = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/getAddListById`, { params });
 export const getAddList1 = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/getAddList`, { params });


 /*活动保存*/
 export const addTtRpMa = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/addTtRpMa`, params);
 /*活动新增vin保存*/
 export const addTtRpMaVin = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/addTtRpMaVin`, params);
 /*活动删除vin保存*/
 export const deleteTtRpMaVin = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/deleteTtRpMaVin`, params);
 /*根据ID查询活动详情*/
 export const getByMaId = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/getByMaId`, { params });
 export const getVinByMaId = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/getVinByMaId`, { params });
 /*删除 活动  Vin  配件等数据*/
 export const delMaItem = params => axios.delete(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/delMaItem`, { params });
 /*审核与驳回*/
 export const savePassOrBack = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/savePassOrBack`, params);
 /*活动下发*/
 export const saveDown = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/saveDown/${params.maId}`, { params });
 /*批量下发*/
 export const piliangxiafa = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/piliangxiafa`, { params });
 /*关闭*/
 export const saveStop = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/saveStop`, params);
 /*关闭*/
 export const changeDate = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/changeDate`, params);
 /*作废 */
 export const changeStatus = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/invalidDown/${params.maId}`, { params });

 //经销商列表查询
 export const byAllInfo = params => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttach/dealerInfo/byAllInfo`, { params });
 //经销商翻译
 // export const byAllTranslate = params => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttach/dealerInfo/byAllTranslate`);
 //责任站查询
 export const byAllTranslate = params => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/ttRpMa/dealerInfo/byAllTranslate`);
 export const getDealer = params => axios.post(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/getDealer`,params);

 // 查询事业部
 export const getOrgList = params => axios.get(`${SERVER.SYSMANAGE}/org/getBusinessOrg`, { params });

 export const queryUnitCode = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partInfos/partGroupCode`, { params });

 export const getRegion = params => axios.get(`/api/basedata/region//listAllData`, { params });

 export const getAllUser = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/users/getDealerUser`);

 export const getNameByIds = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/users/getNameByIds?userIds=${params}`);

 export const getByResDealer = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/getByResDealer`, { params });

 export const downVinTem = params => {
   return axios({
     url: `${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/downVinTem`,
     method: 'get',
     // params:params,
     responseType: 'blob'
   });
 };

 export const downVinTemDelete = params => {
   return axios({
     url: `${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/downVinTemDelete`,
     method: 'get',
     // params:params,
     responseType: 'blob'
   });
 };

 export const exportMaRecord = params => {
   return axios({
     url: `${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/exportMaRecord/activity`,
     method: 'get',
     params: params,
     responseType: 'blob'
   });
 };
 //下载中心导出
 export const exporturl = params => axios.post(`/api/cmscloud.excel/downloadExcel/exportExcel/${params.CODE}`, params);
 // 获取配件供应商信息
 export const getPartSupplier = params => axios.get(`${SERVER.CMSCLOUD_WMS}/part/partinfo/getPartSupplier`,  {params} );

 export const findFileByUrl = params => axios.post(`https://dcs-test-api.livanauto.com/api/file/download/url?fileUrl=` + params );
